using System;
using System.Data.Entity;
using System.Data.Entity.Infrastructure;
using Dal.Entities;
using Dal.Mapping;

namespace Dal
{
	public class YiYuContext : DbContext
	{
		static YiYuContext()
		{ 
			Database.SetInitializer<YiYuContext>(null);
		}

		public DbSet<Doc> Docs { get; set; }
		public DbSet<Doc0> Doc0 { get; set; }
		public DbSet<Doc1> Doc1 { get; set; }
		public DbSet<Doc2> Doc2 { get; set; }
		public DbSet<Doc3> Doc3 { get; set; }
		public DbSet<Doc4> Doc4 { get; set; }
		public DbSet<DocQuestion> DocQuestions { get; set; }
		public DbSet<Message> Messages { get; set; }
		public DbSet<News> News { get; set; }
		public DbSet<Region> Regions { get; set; }
		public DbSet<User> Users { get; set; }

        protected override void OnModelCreating(DbModelBuilder modelBuilder)
		{
            modelBuilder.Conventions.Remove<IncludeMetadataConvention>();
			modelBuilder.Configurations.Add(new DocMap());
			modelBuilder.Configurations.Add(new Doc0Map());
			modelBuilder.Configurations.Add(new Doc1Map());
			modelBuilder.Configurations.Add(new Doc2Map());
			modelBuilder.Configurations.Add(new Doc3Map());
			modelBuilder.Configurations.Add(new Doc4Map());
			modelBuilder.Configurations.Add(new DocQuestionMap());
			modelBuilder.Configurations.Add(new MessageMap());
			modelBuilder.Configurations.Add(new NewsMap());
			modelBuilder.Configurations.Add(new RegionMap());
			modelBuilder.Configurations.Add(new UserMap());
		}
	}
}

